cmake_minimum_required(VERSION 3.15.0)

################ <设定变量> ################
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)    # 设定变量都全局可用

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)   # ​生成compile_commands.json​
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
cmake_policy(SET CMP0135 NEW)
set(FETCHCONTENT_EXTRACT_TIMESTAMP TRUE)
set(DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
set(CMAKE_WARN_DEPRECATED OFF)

set(Third_Party_Dir ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
set(Modules_Dir ${CMAKE_CURRENT_SOURCE_DIR}/modules)
set(Imgui_Dir ${Third_Party_Dir}/imgui)

set(ASSETS_SOURCE_FOLDER ${NATIVERENDER_ROOT_PATH}/assets)
set(FONT_SOURCE_FOLDER ${ASSETS_SOURCE_FOLDER}/fonts)
set(LUA_SOURCE_FOLDER ${ASSETS_SOURCE_FOLDER}/lua)
set(SHADER_SOURCE_FOLDER ${ASSETS_SOURCE_FOLDER}/shaders)

# #
file(GLOB_RECURSE OTF_FILES ${FONT_SOURCE_FOLDER}/*.otf ${FONT_SOURCE_FOLDER}/*.ttf)
file(GLOB_RECURSE LUA_FILES ${LUA_SOURCE_FOLDER}/*.lua)
# #
################ <设定变量> ################

project(myExample VERSION 0.1.0 LANGUAGES C CXX)

# 指定可执行文件和库文件的输出目录
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()

# 引入cmake脚本
include(cmake/ALL.cmake)
include(FetchContent)

# END 引入cmake脚本 
build_type_conf()

# 
link_thirdparty()

# 添加子模块 
add_subdirectory(modules)
# END 添加子模块
